{% extends "base.html" %}

{% block headex %}
<link rel="stylesheet" href="/static/css/browse.css" type="text/css" />
<script type="text/javascript" src="/static/js/jquery-1.10.2.js"></script>	
<script type="text/javascript">
    function newArticle(){
        var url = '/forum/addarticle/' + $("#selType").val() + '/';
        window.open(url, 'frmDetail');
    }
    
    function onChange(obj){
        var newurl = "/forum/list/" + obj.value + "/1/";
        document.getElementById("frmList").src = newurl;
    }

    function onClick(board_id){
        var newurl = "/forum/list/" + board_id + "/1/";
        document.getElementById("frmList").src = newurl;
    }

    $(document).ready(function(){
        $("#menu a[href='/forum/']").css({"color":"#F16522"});
    })

</script>
{% endblock %}


{% block submenu %}
    <span class="submenu">
        {% for board in boards %}
        <a href="#" onclick="javascript:{onClick({{board.id}});}">{{board.name}}</a>
        {% endfor %}
    </span>
{% endblock %}

{% block main %}
<div class="wrapper">

    <iframe id="frmDetail" name="frmDetail" scrolling="auto">
    </iframe>

    <div id="divRight">
        <a id="aPostNew" href="/forum/add/" target="frmDetail">发表新帖子</a>
        <select id="selType" name="selType" onchange="javscript:{onChange(this);}">
            <option value="0" selected>==== 选择论坛版面 ====</option>
            {% for board in boards %}
            <option value="{{board.id}}"> {{board.name}}</option>
            {% endfor %}
        </select>

        <form action="/" method="POST" target="frmList">
            <div class="divSearch">
                <input class="inputText" type="text"  name="key" />
                <input class="btnSearch" type="submit" value="搜索" />
            </div>
        </form>

        <iframe id="frmList" scrolling="auto" src="/forum/latest/1/">
        </iframe>
    </div>
</div>

</div>
{% endblock %}
